home *** CD-ROM | disk | FTP | other *** search
- #ifdef VCSTR
- static char MACROH[]="@(#) macro.h 1.0 91/01/13 16:11:17"; /*sccsid*/
- #endif
- #ifdef DOCUMENTATION
- ******************************* DOCZ Header *********************************
- .MODULE onerror
- .LIBRARY csub
- .TYPE macro
- .APPLICATION system
- .APPLICATION error
- .SYSTEM vms
- .AUTHOR Software Toolz
- .LANGUAGE C
- .DESCRIPTION
- Establish an exception handler
- .ARGUMENTS
- onerror(func)
- int (*func)(); /* (r) the address of the exception handler */
- .NARRATIVE
- Onerror establishes an exception handler for the currently executing
- function. The exception handler will be passed two arguments describing
- the exeption as:
-
- int ex_handle(signal,mechanism)
- int signal[],
- mechanism[];
- .RETURNS
- A pointer to the previous exception vector, or 0 if there was none.
- .EXAMPLE
- /**************************************************************************
- A sample exception handler
- **************************************************************************/
- errfunc(signal,mechanism)
- int signal[],
- mechanism[];
- {
- if (signal[1] != SS$_SSFAIL)
- return (SS$_RESIGNAL);
- LIB$SIGNAL((signal[2] & 0xFFFFFFF8) | 2); /* change FATAL to ERROR */
- puts("Bad Call!\7");
- return (SS$_CONTINUE);
- } /* end errfunc */
-
-
- /**************************************************************************
- Main entry
- **************************************************************************/
- main()
- {
- onerror(errfunc);
- SYS$SETSFM(1); /* set system service failure mode */
- SYS$QIOW(0,0,0,0,0,0,0,0,0,0,0,0); /* bad call */
- puts("> End <");
- }
- .INCLUDES
- csub.h
- csubmac.h
- .ENDOC END DOCUMENTATION
- *****************************************************************************
- #endif
- #define onerror(func) LIB$ESTABLISH(func)
-
-